const db = require('../../MySql')

class sys_role {
    constructor(id,role_name){
        this.id = id
        this.role_name = role_name
    }

    //查询所有角色
    static async findAll() {
        const [rows] = await db.query('select * from sys_role')
        return rows
    }

    //分页查询角色
    static async findRolesByPage(current, size) {
        const [rows] = await db.query('select * from sys_role limit ?,?', [(current - 1) * size, size])
        return rows
    }
}

module.exports = sys_role